import { TileImage } from "./TileImage";

export class XYZ extends TileImage {
  constructor(opts: { [key: string]: any }) {
    const options = opts || {};
    const projection =
      options.projection !== undefined ? options.projection : "EPSG:3857";

    const tileGrid = null;

    super({
      attributions: options.attributions,
      cacheSize: options.cacheSize,
      crossOrigin: options.crossOrigin,
      opaque: options.opaque,
      projection: projection,
      reprojectionErrorThreshold: options.reprojectionErrorThreshold,
      tileGrid: tileGrid,
      tileLoadFunction: options.tileLoadFunction,
      tilePixelRatio: options.tilePixelRatio,
      tileUrlFunction: options.tileUrlFunction,
      url: options.url,
      urls: options.urls,
      wrapX: options.wrapX !== undefined ? options.wrapX : true,
      transition: options.transition,
    });
  }
}
